﻿using System;

namespace Wulong.Phone.Qiushi.ViewModels
{
    public class BusyIndicatorViewModelBase: ViewModelBase
    {
        protected bool _isBusy;
        protected IDisposable _subject;
        public bool IsBusy
        {
            get { return _isBusy; }
            set
            {
                if (_isBusy == value)
                    return;
                _isBusy = value;
                NotifyOfPropertyChange(() => IsBusy);
            }
        }

        protected override void OnDeactivate(bool close)
        {
            if(_subject!=null)
            {
                _subject.Dispose();
                IsBusy = false;
            }
            base.OnDeactivate(close);
        }
    }
}
